<?php
namespace Admin\Controller;
use Think\Controller;
class videoController extends Controller {
    public function index(){
        $this->display();
    }
    public function videolist(){
		$videomodel=M('video');
		$videos=$videomodel->order('vid ')->join('club ON video.cid=club.cid')->select();
		$this->video=$videos;
		$this->display();
	}
	public function delvideo($vid){
	$videomodel=M('video');	
	if (false!==$videomodel->where("vid=$vid")->delete()) {
            $this->success('删除成功！');
        } else {
            $this->error('删除失败');
        }
		
	}
    public   function videoadd(){
        $videos = D('video'); 
        $data['vname']=I('post.vname');
        $data['cid']='1';
        $data['vintroduce']=I('post.vintroduce');
       //data['charge']=I('video.charge');
       //data['atel']=I('video.atel');  
       //data['acontent']=I('video.acontent');
        // $data['vid']=S('vid');
        dump($data);
        
         if(false!==$videos->add($data)){
             $this->success('成功','videolist');
         }else{
            $this->error('失败','videolist');
         }
        }

        public   function editv(){

        $videos = D('video'); 
        $vid=I('post.vid');
        $data['vname']=I('post.vname');
        $data['cid']='1';
        $data['vintroduce']=I('post.vintroduce');
       
        dump($data);
        if(false !== $videos->where("vid=$vid")->save($data)){
            $this->success('成功','videolist');
         }else{
            $this->error('失败');
         }
        }
        public function edit(){    
            $videos = D('video'); 
            $vid=$_GET['vid'];
            $res= $videos->where("vid=$vid")->find();
            $this->video=$res;
         
        $this->display();
        }
}